<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			window.onload = function(){
				var oTxt = document.getElementById("username");
				oTxt.onfocus = function(){//聚焦事件
					alert("请输入用户名");
					
				}
				oTxt.onblur = function(){//划过事件
					alert("您输入的用户名为：" + this.value);
				}
			}
		</script>
	</head>
	<body>
		<form action="">
			<input type="text" name="username" id="username" />
		</form>
	</body>
</html>
